#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include <QTextStream>
#include <QStyleFactory>
#include <QDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // Apply a base style for better cross-platform consistency if needed
    // QApplication::setStyle(QStyleFactory::create("Fusion"));

    // Load and apply QSS stylesheet from resources
    QFile qssFile(":/styles/cartoon_style.qss");
    if (qssFile.open(QFile::ReadOnly | QFile::Text)) {
        QTextStream stream(&qssFile);
        QString styleSheet = stream.readAll();
        a.setStyleSheet(styleSheet);
        qssFile.close();
        qInfo() << "Cartoon stylesheet loaded and applied from resources.";
    } else {
        qWarning() << "Could not load cartoon_style.qss from resources. Using default styles.";
    }

    MainWindow w;
    w.setWindowTitle("MBTI 性格测试 - 卡通版");
    w.show();
    return a.exec();
}

